package com.fy.service.imbusiness.controller;


import com.alibaba.fastjson.JSONObject;
import com.fy.common.dto.BaseIdDto;
import com.fy.common.vo.UserInfoVo;
import com.fy.service.service.SkImUserFriendsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fy.framework.common.model.R;
import com.fy.common.util.TokenUtil;
import com.fy.common.dto.UserDetailQueryDto;
import com.fy.common.dto.UserFriendSettingDto;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户好友关系
 * @author zhshuo
 * @date 2021/12/02 16:45
 **/
@Slf4j
@RestController
@Api(tags = "用户好友相关操作")
@AllArgsConstructor
@RequestMapping("/user/friends")
public class SkImUserFriendsController {

    SkImUserFriendsService userFriendsService;

    /**
     * 好友列表
     * 
     * @return {@link R}
     */
    @PostMapping("list")
    @ApiOperation("好友列表")
    public R<?> list() {
        return userFriendsService.list(TokenUtil.getUserId());
    }

    /**
     * 好友相关设置
     * 
     * @param userFriendSettingDto
     *            好友相关设置
     * @return {@link R}
     */
    @PostMapping("setting")
    @ApiOperation("好友相关设置")
    public R<?> setting(@RequestBody UserFriendSettingDto userFriendSettingDto) {
        return userFriendsService.setting(userFriendSettingDto);
    }

    /**
     * 好友资料
     *
     * @return {@link R}
     */
    @PostMapping("detail")
    @ApiOperation("好友资料")
    public R<UserInfoVo> detail(@RequestBody UserDetailQueryDto detailQueryDto) {
        return userFriendsService.detail(detailQueryDto);
    }

    /**
     * 好友删除
     * @return
     */
    @PostMapping("del")
    @ApiOperation("好友删除")
    public R<?> del(@RequestBody BaseIdDto baseIdDto){
        return userFriendsService.del(baseIdDto);
    }

}